﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TemplateData
{
    public static class Helper
    {
        public static ControlType GetControlType(string controlName)
        {
            var result = ControlType.None;
            switch(controlName)
            {
                case "TextBox":
                    result = ControlType.TextBox;
                    break;
                case "TextBox Multiline":
                    result = ControlType.TextBoxMultiLine;
                    break;
                case "TextBox Calendar":
                    result = ControlType.TextBoxCalendar;
                    break;
                case "TextBox Lookup":
                    result = ControlType.TextBoxLookup;
                    break;
                case "TextBox AutoSuggest":
                    result = ControlType.TextBoxAutoSuggest;
                    break;
                case "TextBox Disabled":
                    result = ControlType.TextBoxDisabled;
                    break;
                case "TextBox Long":
                    result = ControlType.TextBoxLong;
                    break;
                case "TextBox Long Disabled":
                    result = ControlType.TextBoxLongDisabled;
                    break;
                case "RichTextBox":
                    result = ControlType.RichTextBox;
                    break;
                case "Label":
                    result = ControlType.Label;
                    break;
                case "Lookup Only":
                    result = ControlType.LookupOnly;
                    break;
                case "Hyperlink":
                    result = ControlType.Hyperlink;
                    break;
                case "DropDownList":
                    result = ControlType.DropDownList;
                    break;
                case "DropDownList Number":
                    result = ControlType.DropDownListNumber;
                    break;
                case "DropDownList Date":
                    result = ControlType.DropDownListDate;
                    break;
                case "ListBox":
                    result = ControlType.ListBox;
                    break;
                case "File Attachment":
                    result = ControlType.FileAttachment;
                    break;
                case "Radio Button":
                    result = ControlType.RadioButton;
                    break;
                case "CheckBox":
                    result = ControlType.CheckBox;
                    break;
                case "CheckBoxes":
                    result = ControlType.CheckBoxes;
                    break;
            }
            return result;
        }

        public static DataType GetDataType(string dataType)
        {
            var result = DataType.None;

            switch(dataType)
            {
                case "Free Text":
                    result = DataType.FreeText;
                    break;
                case "Number":
                    result = DataType.Number;
                    break;
                case "Date":
                    result = DataType.Date;
                    break;
            }

            return result;
        }
    }
}
